#include <bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"
#define INF 1e18
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;
int n,sum=0,cntt;
const int N=1000100;
int r[N];
int cntone[N],cnttwo[N];
int num[N];
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>r[i];
    sort(r+1,r+n+1);
    for(int i=1;i<=n;i++){
        if(r[i]!=r[i-1])num[++sum]=r[i];
        cntone[r[i]]++;
        cnttwo[r[i]]++;
    }
    for(int i=1;i<sum;i++){
        int a=cntone[num[i]];
        int b=cntone[num[i+1]];
        if(b>=a){
            cntt+=a;
            cntone[num[i]]=0;
            cnttwo[num[i+1]]-=a;
        }
        else {
            cntt+=b;
            cntone[num[i]]-=b;
            cnttwo[num[i+1]]=0;
        }
    }
    for(int i=1;i<=sum;i++){
        if(cnttwo[num[i]]!=0){
            for(int j=i-1;j>0;j--)if(cntone[num[j]]>0){
                int s=cntone[num[j]];
                int tt=cnttwo[num[i]];
                if(tt<=s){
                    cntone[num[j]]-=tt;
                    cntt+=tt;
                    cnttwo[num[i]]=0;
                }
                else {
                    cntone[num[j]]=0;
                    cntt+=s;
                    cnttwo[num[i]]-=s;
                }
            }
        }
    }
    cout<<n-cntt;
    //for(int i=1;i<=sum;i++){
    //    cout<<i<<" "<<cntone[i]<< " " <<cnttwo[i]<<"\n";
    //}
    return 0;
}
